<!--
# coding=UTF-8
# Copyright (c) 2025 Bird Software Solutions Ltd
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Neil Mackenzie - initial API and implementation
#    Benjamin Arfa - improvements
#
-->
{% extends 'base.html' %}

{% block content %}
<h1>Change Psuedocode for Derivation Transformation Rules</h1>

<a href="{% url 'pybirdai:create_transformation_rules_in_python'%}">Back to the Create Python Transformation Rules from MetaData Page</a>

<p> FreeBIRD Application generates all the code for calling the generation transformation rules and executable derivation rules.<br><br>
    For each derivation rule, We have a clear location for where the code should live, users need to do the last step of translating the psuedocode into actual python code.<br><br>
    This <a href="https://youtu.be/MY5drY3RlJs">video</a>   explains how to change the psuedocode for derivation transformation rules into executable Python code. 
    Note that the video shows adding GRSS_CRRYNG_AMNT to the ABSTRCT_INSTRMNT_RL in the Enriched Input Layer, but we recommend using the LDM.<br><br>

    The example code used for the GRSS_CRRYNG_AMNT derived attribute to be added to the FNNCL_ASST_INSTRMNT_DRVD_DT table in the LDM is available  <a href="https://github.com/regcommunity/FreeBIRD/blob/main/birds_nest/pybirdai/bird_data_model.py#L12452">here</a><br><br>
    If you copy this function be sure to copy from the very start of the line above @property , because Python  is very sensitive to the difference between tabs and spaces (and so are Python programmers!)<br><br>

    Because the GRSS_CRRYNG_AMNT has lineage information, make sure to add the following import on line 2 of the bird_data_model.py file if the import statement does not already exist:<br><br>
    from pybirdai.annotations.decorators import lineage<br><br>

    When you are just changing derived fields like GRSS_CRRYNG_AMNT into functions, you do not need to re-run the creation and migration of the database for the functions to work and be called, note that until you do then they will be fields in the database.
</p>


{% endblock %}